import sampleVariance from "./sample_variance.js";

/**
 * [样本标准差](http://en.wikipedia.org/wiki/Standard_deviation#Sample_standard_deviation)
 * 是样本方差的平方根。
 *
 * @param {Array<number>} x 输入数组
 * @returns {number} 样本标准差
 * @example
 * sampleStandardDeviation([2, 4, 4, 4, 5, 5, 7, 9]).toFixed(2);
 * // => '2.14'
 */
function sampleStandardDeviation(x) {
    const sampleVarianceX = sampleVariance(x);
    return Math.sqrt(sampleVarianceX);
}

export default sampleStandardDeviation;
